package com.example.healthcondition.entity;

import org.springframework.boot.autoconfigure.domain.EntityScan;

import java.time.LocalDateTime;


public class User {
    private Integer user_id;
    private String username;
    private String password;
    private String email;
    private LocalDateTime created_at;

    // 默认构造函数
    public User() {
    }

    // 带所有属性的构造函数
    public User(Integer user_id, String username, String password, String email, LocalDateTime created_at) {
        this.user_id = user_id;
        this.username = username;
        this.password = password;
        this.email = email;
        this.created_at = created_at;
    }

    // Getter和Setter方法
    public Integer getUserId() {
        return user_id;
    }

    public void setUserId(Integer user_id) {
        this.user_id = user_id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public LocalDateTime getCreatedAt() {
        return created_at;
    }

    public void setCreatedAt(LocalDateTime created_at) {
        this.created_at = created_at;
    }

    // toString方法
    @Override
    public String toString() {
        return "User{" +
                "user_id=" + user_id +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", email='" + email + '\'' +
                ", created_at=" + created_at +
                '}';
    }

    // hashCode和equals方法
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        User user = (User) o;
        return user_id != null && user_id.equals(user.user_id);
    }

    @Override
    public int hashCode() {
        return user_id != null ? user_id.hashCode() : 0;
    }
}
